<%@ Language=VBScript %>
<%Option Explicit%>

<!--#include file="../cons.asp"-->
<!--#include file="../../Common/Database.asp"-->
<!--#include file="PrintResumenCurricular.asp"-->
<%
if cint(Application("iCount")) = cint(Application("CountAlumnos")) and (cint(Application("iCount")) <> 0 or cint(Application("CountAlumnos")) <> 0)then
	Application("iCount") = 0
	Application("CountAlumnos") = 0
end if
%>
<script src="../../js/prototype.js" type="text/javascript"></script>

<!-- jsProgressBarHandler prerequisites : prototype.js -->
<script type="text/javascript" src="../../js/prototype.js"></script>

<!-- jsProgressBarHandler core -->
<script type="text/javascript" src="../../js/jsProgressBarHandler.js"></script>
<link rel="stylesheet" type="text/css" href="../../Styles/jsProgressBarHandler.css" media="screen" />

<input type="button" value="Generar Listados" 
<%
if cint(Application("CountAlumnos")) <> 0 or cint(Application("iCount")) <> 0 then
	response.Write " disabled "
end if
%>
onclick="GeneraListados(); this.value = 'Generando Listados...'; this.disabled = true;">

<br>
<span class="progressBar percentImage1" id="element1">0%</span>

<script>
function GeneraListados()
{
	new Ajax.Request('AJAX_GeneraListados.asp',{
								method:'get',
								onSuccess:	function(transport)
											{
												//alert(transport.responseText);
												var response = transport.responseText || "no response text";       
												//alert("Success! \n\n" + response);
												//ProgressBAR.innerHTML = response;
											},
								onFailure: function()
											{
													alert('Something went wrong...') 
											}   
								}
					); 
}
var interval;
function GPBInterval()
{
	interval = setInterval('GetProgressBAR()',3000);
	//GetProgressBAR();
}
function GetProgressBAR()
{
	new Ajax.Request('AJAX_GetProgressBAR.asp',{
								method:'get',
								onSuccess:	function(transport)
											{
												//alert(transport.responseText);
												var response = transport.responseText || "no response text";       
												//alert("Success! \n\n" + parseInt(response));
												//ProgressBAR.innerHTML = response;
												if (transport.responseText != false)
													myJsProgressBarHandler.setPercentage('element1',response);
												if(response == "100")
													clearTimeout(interval);
											},
								onFailure: function()
											{
													alert('Something went wrong...') 
											}   
								}
					); 
}
GPBInterval();
/*
function getResponse2() {
  AjaxRequest.get(
    {
      'url':'AJAX_GeneraListados.asp'
      ,'onSuccess':function(req){  }
      ,groupName:'a'
      ,onInteractive:function(){alert('b')}
    }
  );
}

function getResponse() {
  AjaxRequest.get(
    {
      'url':'AJAX_GetProgressBAR.asp'
      ,'onSuccess':function(req){ ProgressBAR.innerHTML=req.responseText; }
      ,groupName:'a'
      ,onInteractive:function(){alert('b')}
    }
  );
}
*/

</script>